package com.samsung.sds.ssa.jsca.editor;

import org.eclipse.core.resources.IResourceChangeEvent;
import org.eclipse.core.resources.IResourceChangeListener;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.ui.editors.text.TextEditor;

public class JSPEditor extends TextEditor implements IResourceChangeListener {

	private ColorManager colorManager;

	public JSPEditor() {
		super();
		colorManager = new ColorManager();
		
		ResourcesPlugin.getWorkspace().addResourceChangeListener(this, IResourceChangeEvent.POST_CHANGE);
		
		setSourceViewerConfiguration(new JSPConfiguration(colorManager));
		setDocumentProvider(new JSPDocumentProvider());
	}
	public void dispose() {
		colorManager.dispose();
		super.dispose();
	}
	@Override
	public void resourceChanged(IResourceChangeEvent event) {
		try {
			JSExplorer.updateScopeChain(event);
		} catch (CoreException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
